home *** CD-ROM | disk | FTP | other *** search
-
-
-
- RRRRWWWWTTTTiiiimmmmeeeerrrr((((3333CCCC++++++++)))) RRRRWWWWTTTTiiiimmmmeeeerrrr((((3333CCCC++++++++))))
-
-
-
- NNNNaaaammmmeeee
- RWTimer - Rogue Wave library class
-
- SSSSyyyynnnnooooppppssssiiiissss
- #include <rw/timer.h>
-
-
-
- RWTimer timer;
-
-
-
-
- DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
- This class can measure elapsed CPU (user) time. The timer has two
- states: running and stopped. The timer measures the total amount of time
- spent in the "running" state since it was either constructed or reset.
- The timer is put into the "running" state by calling member function
- ssssttttaaaarrrrtttt(((()))). It is put into the "stopped" state by calling ssssttttoooopppp(((()))). RRRRWWWWTTTTiiiimmmmeeeerrrr
- uses the system-dpendent function cccclllloooocccckkkk(((()))) which returns the number of
- "ticks" since it was first called. As a result, RRRRWWWWTTTTiiiimmmmeeeerrrr will not be able
- to measure intervals longer than some system-dependent value. (For
- instance, on several common UNIX systems, this value is just under 36
- minutes.)
-
- PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
- None
-
- EEEExxxxaaaammmmpppplllleeee
- This example prints out the amount of CPU time used while looping for 5
- seconds (as measured using class RRRRWWWWTTTTiiiimmmmeeee).
-
- #include <rw/timer.h>
-
-
-
- #include <rw/rwtime.h>
- #include <rw/rstream.h>
- main()
- {RWTimer t;
- t.start(); // Start the timer
- RWTime start;
- start.now(); // Record starting time
- // Loop for 5 seconds:
- for (RWTime current; current.seconds() - start.seconds() < 5;
- current = RWTime::now())
- {;}
- t.stop(); // Stop the timer
- cout << t.elapsedTime() << endl;
- return 0;
- }
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- RRRRWWWWTTTTiiiimmmmeeeerrrr((((3333CCCC++++++++)))) RRRRWWWWTTTTiiiimmmmeeeerrrr((((3333CCCC++++++++))))
-
-
-
- PPPPrrrrooooggggrrrraaaammmm oooouuuuttttppppuuuutttt ((((eeeexxxxaaaacccctttt vvvvaaaalllluuuueeee mmmmaaaayyyy ddddiiiiffffffffeeeerrrr))))::::
-
- 5.054945
-
-
-
- PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr
-
-
-
-
- RRRRWWWWTTTTiiiimmmmeeeerrrr();
-
-
- Constructs a new timer. The timer will not start running until ssssttttaaaarrrrtttt(((())))
- is called.
-
- PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
- double
- eeeellllaaaappppsssseeeeddddTTTTiiiimmmmeeee() const;
-
-
- Returns the amount of (CPU) time that has accumulated while the timer was
- in the running state.
-
- void
- rrrreeeesssseeeetttt();
-
-
- Resets (and stops) the timer.
-
- void
- ssssttttaaaarrrrtttt();
-
-
- Puts the timer in the "running" state. Time accumulates while in this
- state.
-
- void
- ssssttttoooopppp();
-
-
- Puts the timer in the "stopped" state. Time will not accumulate while in
- this state.
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-